/* --------------------------------------

B3_SwapsPFICBanks.do

by: Kristy A.E. Jansen

This do-file: Construct figures swap exposures based on EMIR in Jansen (2024)
	1. Figure 5+IA6

-------------------------------------- */

/* Initialization */
clear all
set more off
capture log clear _all

global root "~/RFS_replication" // *** NEED TO CHANGE THIS TO CORRECT FILE PATH ***
global main_data $root/Data

/* Load Data */
use "$main_data/swaps_PFIC_Banks.dta", clear 

/* Figure */
display("Figure 5: Exposures to interest rates: P&Is versus banks") // same code to create Figure IA6
separate net_pos, by(group)

g temp = net_pos1*10 /* Scale y-var */

twoway bar net_pos2 mat_bucket, base(0) color(midgreen%30) barw(0.6)  ///
yaxis(1 2)  yti("P&I (billions)", axis(1)) ylabel(-40(10)50, axis(1))  ///
xlabel(1 "[1,5)" 2 "[5,10)" 3 "[10,15)" 4 "[15,20)" 5 "[20,25)" 6 "[25,30)" 7 "[30,-->)") xtitle("") || ///
bar temp mat_bucket, base(0) color(ebblue) barw(0.6)   yti("Banks (billions)", axis(2))  ///
ylabel(-40 "4" -30 "3" -20 "-2" -10 "-1" 0 "0" 10 "1" 20 "2" 30 "3" 40 "4", axis(2)) ///
, legend(order(1 "P&I" 2 "Banks" ))
